<?php

uses('sanitize');
$sanitize = new Sanitize();

?>
<h1>Inbound links for the past 24 hours</h1>
<table class="prettytable">
    <tr>
	<th>Page</th>
	<th>Referer</th>
	<?php if(isset($isAdmin) && $isAdmin) { ?>
	    <th>IP</th>
	<?php } ?>
	<th>Date</th>
    </tr>
<?php

foreach($visits as $visit)
{
    if(strpos($visit['Visit']['url'], 'openid') === false && strpos($visit['Visit']['referer'], 'is-a-geek.com') === false)
    {

?>
    <tr>
	<td><?php echo $html->link($visit['Visit']['url'], $sanitize->html($visit['Visit']['url'])); ?></td>
	<td>
	    <?php
	    
		ereg('https?://([^/]*)/.*', $visit['Visit']['referer'], $matches);
		echo $html->link($matches[1], $sanitize->html($visit['Visit']['referer']));
	
	    ?>
	</td>
	<?php if(isset($isAdmin) && $isAdmin) { ?>
	    <td>
		<?php echo $visit['Visit']['ip']; ?>
	    </td>
	<?php } ?>
	<td><?php echo $visit['Visit']['created']; ?></td>
    </tr>
<?php

    }
}
    
?>
</table>